package com.homework.ch01;

import java.util.function.IntConsumer;

/**
 * @author yuxi
 * @version 1.0
 * @date 2025/10/22
 * @Description:
 */
public class Test4 {
    public static void main(String[] args) {
        foreachArr(new IntConsumer() {
            @Override
            public void accept(int value) {
                System.out.print(value+" ");
            }
        });
        System.out.println();
        foreachArr(System.out::print);
    }
    public static void foreachArr(IntConsumer consumer){
        int[] arr = {1,2,3,4,5,6,7,8,9,10};
        for (int i : arr) {
            consumer.accept(i);
        }
    }
}
